package com.xiaxueqi.utils;

import java.util.Map;

import org.apache.struts2.util.StrutsTypeConverter;

public class DoubleConvert extends StrutsTypeConverter {

	@Override
	public Object convertFromString(Map context, String[] value, Class toClass) {
		if (Double.class == toClass) {
			String doubleStr = value[0];
			System.out.println("获取到的字符串" + doubleStr);
			Double d = Double.parseDouble(doubleStr);
			return d;
		}
		return 0;
	}

	@Override
	public String convertToString(Map context, Object obj) {
		return obj.toString();
	}

}
